/**
 * @see https://umijs.org/docs/max/access#access
 * */
export default function access(initialState: { currentUser?: API.UserVO } | undefined) {
  const { currentUser } = initialState ?? {};
  return {
    // 管理员权限
    canAdmin: currentUser && currentUser.role === 2,
    // 教师权限
    isTeacher: currentUser && currentUser.role === 1,
    // 学生专属
    isStudent: currentUser && currentUser.role === 0,
  };
}
